#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a = int(input("请输入一元二次方程2次幂系数a:"))
b = int(input("请输入一元二次方程1次幂系数b:"))
c = int(input("请输入一元二次方程常数c:"))

import math

def quadratic(a, b ,c):
    if not (isinstance(a,(int,float)) and isinstance (b, (int, float)) and isinstance (c , (int, float))):
        raise TypeError('bad operand type')
    if a == 0:
        raise TypeError('a不能为0') 
    #判断根的个数，然后返回相应的函数值
    h = b * b - 4 * a * c
    if h<0:        
        return "方程无解"
    elif h == 0:
        print('方程有两个相同的实根')
        x = -b / (2 * a)
        return x
    else:
        print('方程有两个不同的实根')
        x1 = (-b+math.sqrt(h)) / (2*a)
        x2 = (-b-math.sqrt(h)) / (2*a)
        return x1, x2

print(quadratic(a, b, c))